<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %> 
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>

<%@ page import="com.scalar.chiptrack.utils.ConfigManager,
                com.scalar.chiptrack.utils.StringUtils,
                com.scalar.chiptrack.users.Functionality,
                com.scalar.chiptrack.operations.Inventory,
                com.scalar.chiptrack.users.User,
                com.scalar.chiptrack.commons.SessionKeys,
				com.scalar.chiptrack.sales.LineItem,
                com.scalar.chiptrack.commons.Constants,
                java.util.Date,
                java.util.Calendar,
                java.util.GregorianCalendar,
                java.util.ArrayList"%>

<HTML><HEAD><TITLE>ScalarSoft - ChipTrac</TITLE>

<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>

<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type='text/css' rel='stylesheet'>

<META content="MSHTML 5.50.4807.2300" name=GENERATOR>
<script language="JavaScript" src="<%=chipTracContext%>/jsp/includes/scripts/validations.js">
</script>
<script language="JavaScript">

function closeWindow ()
{
	var openerDoc = window.opener.document;
	if( openerDoc.all.fromOrderScheduling.value != "false" )
	{
		window.opener.searchOrderList(openerDoc.scheduling);
	}
    window.close();
}

function submitForm( actionValue )
{
	var errors1 = '';
	if( dateValidation() == false )
	{
		errors1 = errors;
    }

	if( errors1 != '' )
    {
		var pa = document.getElementById( "errors" );
        pa.innerHTML = errors1;
		return;
	}

	if( window.opener.document.approverOrderForm != null )
	{
		if( actionValue == 'saveScheduleDate' )
		{
			window.opener.setScheduleDate( document.lineItemForm.lineItemId.value, document.lineItemForm.scheduleDate.value );
            window.opener.giveMsg();
		}
		else if( actionValue == 'releaseLots' )
		{
			window.opener.setScheduleDate( document.lineItemForm.lineItemId.value, '' );
		}
	}

    document.lineItemForm.action = '<%=chipTracContext%>/scheduling.do?action=' + actionValue;
    document.lineItemForm.submit();
}

var errors = "";

function dateValidation()
{
	errors = "";
	var dateValue = "";
    var tempDate = document.lineItemForm.scheduleDate;

	if( typeof tempDate.length == 'undefined' )
    {
	    if( chkScheduleRevisedDate( tempDate.value.trim(), "Schedule Date", "Y" ) == false )
		{
			errors = errMsg;
			tempDate.select();
			tempDate.focus();
		}
        else if ( isBeforeToday( tempDate.value.trim(),"Schedule Date" ) ) // added by sujan schedule date can not be before today date
        {
            errors = errMsg;
			tempDate.select();
			tempDate.focus();
        }
	}
	else
	{
		for( var i = 0; i < tempDate.length; i++ )
		{
			if( chkScheduleRevisedDate( tempDate[i].value.trim(), "Schedule Date", "Y" ) == false )
			{
				errors = errMsg;
				tempDate[i].select();
				tempDate[i].focus();
				break ;
			}
            else if ( isBeforeToday( tempDate[i].value.trim(),"Schedule Date" ) ) // sujan schedule date can not be before today date
            {
                errors = errMsg;
			    tempDate[i].select();
			    tempDate[i].focus();
                break;
            }
		}//for
    } //else

    if( errors != '' )
		return false;
    else
        return true;
}

function openCalendar(dateValue)
{
    dateElement = dateValue;
    newWindow1 = window.open('<%=chipTracContext%>/jsp/includes/calendar.html','optionsPopup1','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=no,width=180,height=440,resizable=no');
    newWindow1.moveTo(550,180);
    newWindow1.focus();
}


var requestedDt = "";

function openScheduleCalendar(dateValue, requestedDtValue)
{
	dateElement = dateValue;
	requestedDt = requestedDtValue;
	newWindow = window.open('<%=chipTracContext%>/jsp/includes/scheduleCalendar.html','scheduleCalendarPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=no,width=180,height=440,resizable=no');
	newWindow.moveTo(550,180);
	newWindow.focus();
}

function assignDate(passedValue)
{
    dateElement.value=passedValue;
    window.focus();
}

function showInventory( fromDate, toDate )
{
	var partNo = document.lineItemForm.mfgPartNo.value; 
  	newWindow =  window.open('scheduling.do?action=showLotDetail&mfgPartNo='+partNo+'&fromDate='+fromDate+'&toDate='+toDate,'lotDetails','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=yes,scrollbars=yes,top=0,left=0,width=600,height=300,resizable=yes');
	newWindow.focus();
}

function showBackLog( fromDate, toDate )
{
	var partNo = document.lineItemForm.mfgPartNo.value; 
  	newWindow =  window.open('scheduling.do?action=showLineItemDetail&mfgPartNo='+partNo+'&fromDate='+fromDate+'&toDate='+toDate,'lotDetails','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=yes,scrollbars=yes,top=0,left=0,width=600,height=300,resizable=yes');
	newWindow.focus();
}
</script>

</HEAD>
<BODY bgcolor="ffffff" marginheight="0" marginwidth="0" topmargin=0 leftmargin=0 >
<table cellpadding="10" cellspacing="0" border="0" width="100%">
<%
		LineItem lineItem = (LineItem)session.getAttribute( "lineItem" );
        String closeWindowAfterSessionTimeOut = ( String ) request.getAttribute( "closeWindowAfterSessionExp" );
if ( closeWindowAfterSessionTimeOut == null )
{
	%>
	<tr bgcolor="#8C87A8">
		<td height="30" valign="top" align=center>
			<font class="NArialL"><font color="#FFFFFF">Order Scheduling For Product ->> 
			<%= lineItem.getManufacturingPartNo() %></font><br>
		</td>
	</tr>
</table>
<% User users = (User) session.getAttribute (SessionKeys.USER_KEY); %>
<form name='lineItemForm' method='post'>
    <input type='hidden' name='lineItemNo' value='<%=lineItem.getLineItemNo()%>'>
    <input type='hidden' name='salesOrderId' value='<%=lineItem.getSalesOrderId()%>'>
    <input type='hidden' name='requestedDate' value='<%=lineItem.getRequestDate()%>'>
    <input type='hidden' name='marketingPartNo' value='<%=lineItem.getMarketingPartNo()%>'>
	<input type='hidden' name='mfgPartNo' value='<%=lineItem.getManufacturingPartNo()%>'>
    <input type='hidden' name='quantity' value='<%=lineItem.getQuantity()%>'>
    <input type='hidden' name='lineItemId' value='<%=lineItem.getLineItemId()%>'>

<% Calendar calDate = new GregorianCalendar();
   Date date11 = new Date();
   calDate.setTime(date11);   
   
   calDate.add(Calendar.DATE,6);
   Date date12 = calDate.getTime();
   String week1 = StringUtils.formatDateToString(date11,"MM/dd/yy") + " to " +StringUtils.formatDateToString(date12,"MM/dd/yy");
   
   calDate.add(Calendar.DATE,1);
   Date date21 = calDate.getTime();
   calDate.add(Calendar.DATE,6);
   Date date22 = calDate.getTime();
   String week2 = StringUtils.formatDateToString(date21,"MM/dd/yy") + " to " +StringUtils.formatDateToString(date22,"MM/dd/yy");
   
   calDate.add(Calendar.DATE,1);
   Date date31 = calDate.getTime();
   calDate.add(Calendar.DATE,6);
   Date date32 = calDate.getTime();
   String week3 = StringUtils.formatDateToString(date31,"MM/dd/yy") + " to " +StringUtils.formatDateToString(date32,"MM/dd/yy");

   calDate.add(Calendar.DATE,1);
   Date date41 = calDate.getTime();
   calDate.add(Calendar.DATE,6);
   Date date42 = calDate.getTime();
   String week4 = StringUtils.formatDateToString(date41,"MM/dd/yy") + " to " +StringUtils.formatDateToString(date42,"MM/dd/yy");
   
   calDate.add(Calendar.DATE,1);
   Date date51 = calDate.getTime();
   calDate.add(Calendar.DATE,6);
   Date date52 = calDate.getTime();
   String week5 = StringUtils.formatDateToString(date51,"MM/dd/yy") + " to " +StringUtils.formatDateToString(date52,"MM/dd/yy");

   calDate.add(Calendar.DATE,1);
   Date date61 = calDate.getTime();
   calDate.add(Calendar.DATE,6);
   Date date62 = calDate.getTime();
   String week6 = StringUtils.formatDateToString(date61,"MM/dd/yy") + " to " +StringUtils.formatDateToString(date62,"MM/dd/yy");

   calDate.add(Calendar.DATE,1);
   Date date71 = calDate.getTime();
   calDate.add(Calendar.DATE,6);
   Date date72 = calDate.getTime();
   String week7 = StringUtils.formatDateToString(date71,"MM/dd/yy") + " to " +StringUtils.formatDateToString(date72,"MM/dd/yy");

   calDate.add(Calendar.DATE,1);
   Date date81 = calDate.getTime();
   calDate.add(Calendar.DATE,6);
   Date date82 = calDate.getTime();
   String week8 = StringUtils.formatDateToString(date81,"MM/dd/yy") + " to " +StringUtils.formatDateToString(date82,"MM/dd/yy");

   calDate.add(Calendar.DATE,1);
   Date date91 = calDate.getTime();
   calDate.add(Calendar.DATE,6);
   Date date92 = calDate.getTime();
   String week9 = StringUtils.formatDateToString(date91,"MM/dd/yy") + " to " +StringUtils.formatDateToString(date92,"MM/dd/yy");

   calDate.add(Calendar.DATE,1);
   Date date101 = calDate.getTime();
   calDate.add(Calendar.DATE,6);
   Date date102 = calDate.getTime();
   String week10 = StringUtils.formatDateToString(date101,"MM/dd/yy") + " to " +StringUtils.formatDateToString(date102,"MM/dd/yy");

   calDate.add(Calendar.DATE,1);
   Date date111 = calDate.getTime();
   calDate.add(Calendar.DATE,6);
   Date date112 = calDate.getTime();
   String week11 = StringUtils.formatDateToString(date111,"MM/dd/yy") + " to " +StringUtils.formatDateToString(date112,"MM/dd/yy");

   calDate.add(Calendar.DATE,1);
   Date date121 = calDate.getTime();
   calDate.add(Calendar.DATE,6);
   Date date122 = calDate.getTime();
   String week12 = StringUtils.formatDateToString(date121,"MM/dd/yy") + " to " +StringUtils.formatDateToString(date122,"MM/dd/yy");

   calDate.add(Calendar.DATE,1);
   Date date131 = calDate.getTime();
   calDate.add(Calendar.DATE,6);
   Date date132 = calDate.getTime();
   String week13 = StringUtils.formatDateToString(date131,"MM/dd/yy") + " to " +StringUtils.formatDateToString(date132,"MM/dd/yy");


%>
	<table border="0" width="100%" bordercolor="#FFFFFF">
		<tr>
			<font class='NArialS'><font color='blue'><b><li>Substitutable part inventory is not considered</b></font></font></td>
		</tr>
	</table>
	<table border="0" width="100%" bordercolor="#FFFFFF">
		<tr>
			<td width="15%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF"></font></font></td>
			<td width="6%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF"><%=week1 %></font></font></td>
			<td width="6%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF"><%=week2 %></font></font></td>
			<td width="6%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF"><%=week3 %></font></font></td>
			<td width="6%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF"><%=week4 %></font></font></td>
			<td width="6%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF"><%=week5 %></font></font></td>
			<td width="6%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF"><%=week6 %></font></font></td>
			<td width="6%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF"><%=week7 %></font></font></td>
			<td width="6%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF"><%=week8 %></font></font></td>
			<td width="6%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF"><%=week9 %></font></font></td>
			<td width="6%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF"><%=week10 %></font></font></td>
			<td width="6%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF"><%=week11 %></font></font></td>
			<td width="6%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF"><%=week12 %></font></font></td>
			<td width="6%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF"><%=week13 %></font></font></td>
		</tr>
	
		<tr><td colspan=14 bgcolor="#FFFFEE"><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height='5'></td></tr>

		<%	
			int bgcount = 0;
			ArrayList list = (ArrayList) request.getAttribute("scheduleUnits"); 

			if( list != null )
			{
				for(int i=0; i<list.size(); i++)
				{
					Inventory inventory = (Inventory) list.get(i);
					bgcount++;
					if( bgcount == 4 ) 
					{
		%>
		<tr><td colspan=14 bgcolor="#000000"><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=1></td></tr>
        <%			
					} 
					else if (  bgcount == 6  )
					{
		%>
		<tr><td colspan=14 bgcolor="#FFFFEE"><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20></td></tr>
		<%
					}
		%>
		<tr <%if(bgcount%2==0){%> bgcolor='#DEE1E2' <% } else {%> bgcolor='#FFFFEE' <%}%>>
			<td width="15%" align="center"><font class="NArialL"><%=inventory.getProcessType()%></font></td>
			<%	if( inventory.getProcessType().equalsIgnoreCase( "Shippable Units" ) )
				{
			%>
			
			<td width="6%" align="center"><font class="NArialL">
			<% 
					if( inventory.getWeek1() != 0 )
					{
			%>
			<A href="javascript:showInventory( '<%=StringUtils.formatDateToString( date11 )%>', '<%=StringUtils.formatDateToString( date12 )%>' );" onMouseOver="window.status='Click to View Inventory Details';return true" onMouseOut="window.status='';return true"><%=inventory.getWeek1()%></A>
			<%		
					}
					else
					{
			%>
					<%=inventory.getWeek1()%>
			<%
					}	
			%>
			</font></td>
			<td width="6%" align="center"><font class="NArialL">
			<% 
					if( inventory.getWeek2() != 0 )
					{
			%>
			<A href="javascript:showInventory( '<%=StringUtils.formatDateToString( date21 )%>', '<%=StringUtils.formatDateToString( date22 )%>' );" onMouseOver="window.status='Click to View Inventory Details';return true" onMouseOut="window.status='';return true"><%=inventory.getWeek2()%></A>
			<%		
					}
					else
					{
			%>
					<%=inventory.getWeek2()%>
			<%
					}	
			%>

			</font></td>
			<td width="6%" align="center"><font class="NArialL">
			<% 
					if( inventory.getWeek3() != 0 )
					{
			%>
			<A href="javascript:showInventory( '<%=StringUtils.formatDateToString( date31 )%>', '<%=StringUtils.formatDateToString( date32 )%>' );" onMouseOver="window.status='Click to View Inventory Details';return true" onMouseOut="window.status='';return true"><%=inventory.getWeek3()%></A>
			<%		
					}
					else
					{
			%>
					<%=inventory.getWeek3()%>
			<%
					}	
			%>
			</font></td>
			<td width="6%" align="center"><font class="NArialL">
			<% 
					if( inventory.getWeek4() != 0 )
					{
			%>

			<A href="javascript:showInventory( '<%=StringUtils.formatDateToString( date41 )%>', '<%=StringUtils.formatDateToString( date42 )%>' );" onMouseOver="window.status='Click to View Inventory Details';return true" onMouseOut="window.status='';return true"><%=inventory.getWeek4()%></A>
			<%		
					}
					else
					{
			%>
					<%=inventory.getWeek4()%>
			<%
					}	
			%>
			</font></td>
			<td width="6%" align="center"><font class="NArialL">
			<% 
					if( inventory.getWeek5() != 0 )
					{
			%>

			<A href="javascript:showInventory( '<%=StringUtils.formatDateToString( date51 )%>', '<%=StringUtils.formatDateToString( date52 )%>' );" onMouseOver="window.status='Click to View Inventory Details';return true" onMouseOut="window.status='';return true"><%=inventory.getWeek5()%></A>
			<%		
					}
					else
					{
			%>
					<%=inventory.getWeek5()%>
			<%
					}	
			%>
			</font></td>
			<td width="6%" align="center"><font class="NArialL">
			<% 
					if( inventory.getWeek6() != 0 )
					{
			%>

			<A href="javascript:showInventory( '<%=StringUtils.formatDateToString( date61 )%>', '<%=StringUtils.formatDateToString( date62 )%>' );" onMouseOver="window.status='Click to View Inventory Details';return true" onMouseOut="window.status='';return true"><%=inventory.getWeek6()%></A>
			<%		
					}
					else
					{
			%>
					<%=inventory.getWeek6()%>
			<%
					}	
			%>
			</font></td>
			<td width="6%" align="center"><font class="NArialL">
			<% 
					if( inventory.getWeek7() != 0 )
					{
			%>

			<A href="javascript:showInventory( '<%=StringUtils.formatDateToString( date71 )%>', '<%=StringUtils.formatDateToString( date72 )%>' );" onMouseOver="window.status='Click to View Inventory Details';return true" onMouseOut="window.status='';return true"><%=inventory.getWeek7()%></A>
			<%		
					}
					else
					{
			%>
					<%=inventory.getWeek7()%>
			<%
					}	
			%>
			</font></td>
			<td width="6%" align="center"><font class="NArialL">
			<% 
					if( inventory.getWeek8() != 0 )
					{
			%>
			<A href="javascript:showInventory( '<%=StringUtils.formatDateToString( date81 )%>', '<%=StringUtils.formatDateToString( date82 )%>' );" onMouseOver="window.status='Click to View Inventory Details';return true" onMouseOut="window.status='';return true"><%=inventory.getWeek8()%></A>
			<%		
					}
					else
					{
			%>
					<%=inventory.getWeek8()%>
			<%
					}	
			%>
			</font></td>
			<td width="6%" align="center"><font class="NArialL">
			<% 
					if( inventory.getWeek9() != 0 )
					{
			%>

			<A href="javascript:showInventory( '<%=StringUtils.formatDateToString( date91 )%>', '<%=StringUtils.formatDateToString( date92 )%>' );" onMouseOver="window.status='Click to View Inventory Details';return true" onMouseOut="window.status='';return true"><%=inventory.getWeek9()%></A>
			<%		
					}
					else
					{
			%>
					<%=inventory.getWeek9()%>
			<%
					}	
			%>
			</font></td>
			<td width="6%" align="center"><font class="NArialL">
			<% 
					if( inventory.getWeek10() != 0 )
					{
			%>
			<A href="javascript:showInventory( '<%=StringUtils.formatDateToString( date101 )%>', '<%=StringUtils.formatDateToString( date102 )%>' );" onMouseOver="window.status='Click to View Inventory Details';return true" onMouseOut="window.status='';return true"><%=inventory.getWeek10()%></A>
			<%		
					}
					else
					{
			%>
					<%=inventory.getWeek10()%>
			<%
					}	
			%>
			</font></td>
			<td width="6%" align="center"><font class="NArialL">
			<% 
					if( inventory.getWeek11() != 0 )
					{
			%>
			<A href="javascript:showInventory( '<%=StringUtils.formatDateToString( date111 )%>', '<%=StringUtils.formatDateToString( date112 )%>' );" onMouseOver="window.status='Click to View Inventory Details';return true" onMouseOut="window.status='';return true"><%=inventory.getWeek11()%></A>
			<%		
					}
					else
					{
			%>
					<%=inventory.getWeek11()%>
			<%
					}	
			%>
			</font></td>
			<td width="6%" align="center"><font class="NArialL">
			<% 
					if( inventory.getWeek12() != 0 )
					{
			%>
			<A href="javascript:showInventory( '<%=StringUtils.formatDateToString( date121 )%>', '<%=StringUtils.formatDateToString( date122 )%>' );" onMouseOver="window.status='Click to View Inventory Details';return true" onMouseOut="window.status='';return true"><%=inventory.getWeek12()%></A>
			<%		
					}
					else
					{
			%>
					<%=inventory.getWeek12()%>
			<%
					}	
			%>
			</font></td>
			<td width="6%" align="center"><font class="NArialL">
			<% 
					if( inventory.getWeek13() != 0 )
					{
			%>
			<A href="javascript:showInventory( '<%=StringUtils.formatDateToString( date131 )%>', '<%=StringUtils.formatDateToString( date132 )%>' );" onMouseOver="window.status='Click to View Inventory Details';return true" onMouseOut="window.status='';return true"><%=inventory.getWeek13()%></A>
			<%		
					}
					else
					{
			%>
					<%=inventory.getWeek13()%>
			<%
					}	
			%>
			</font></td>

			<%
				}
				else if( inventory.getProcessType().equalsIgnoreCase( "B/L By sch. Date" ) )
				{
			%>
			<td width="6%" align="center"><font class="NArialL">
			<% 
					if( inventory.getWeek1() != 0 )
					{
			%>
			<A href="javascript:showBackLog( '<%=StringUtils.formatDateToString( date11 )%>', '<%=StringUtils.formatDateToString( date12 )%>' );" onMouseOver="window.status='Click to View BackLog Details';return true" onMouseOut="window.status='';return true"><%=inventory.getWeek1()%></A>
			<%		
					}
					else
					{
			%>
					<%=inventory.getWeek1()%>
			<%
					}	
			%>
			</font></td>
			<td width="6%" align="center"><font class="NArialL">
			<% 
					if( inventory.getWeek2() != 0 )
					{
			%>
			<A href="javascript:showBackLog( '<%=StringUtils.formatDateToString( date21 )%>', '<%=StringUtils.formatDateToString( date22 )%>' );" onMouseOver="window.status='Click to View BackLog Details';return true" onMouseOut="window.status='';return true"><%=inventory.getWeek2()%></A>
			<%		
					}
					else
					{
			%>
					<%=inventory.getWeek2()%>
			<%
					}	
			%>
			</font></td>
			<td width="6%" align="center"><font class="NArialL">
			<% 
					if( inventory.getWeek3() != 0 )
					{
			%>
			<A href="javascript:showBackLog( '<%=StringUtils.formatDateToString( date31 )%>', '<%=StringUtils.formatDateToString( date32 )%>' );" onMouseOver="window.status='Click to View BackLog Details';return true" onMouseOut="window.status='';return true"><%=inventory.getWeek3()%></A>
			<%		
					}
					else
					{
			%>
					<%=inventory.getWeek3()%>
			<%
					}	
			%>
			</font></td>
			<td width="6%" align="center"><font class="NArialL">
			<% 
					if( inventory.getWeek4() != 0 )
					{
			%>

			<A href="javascript:showBackLog( '<%=StringUtils.formatDateToString( date41 )%>', '<%=StringUtils.formatDateToString( date42 )%>' );" onMouseOver="window.status='Click to View BackLog Details';return true" onMouseOut="window.status='';return true"><%=inventory.getWeek4()%></A>
			<%		
					}
					else
					{
			%>
					<%=inventory.getWeek4()%>
			<%
					}	
			%>
			</font></td>
			<td width="6%" align="center"><font class="NArialL">
			<% 
					if( inventory.getWeek5() != 0 )
					{
			%>

			<A href="javascript:showBackLog( '<%=StringUtils.formatDateToString( date51 )%>', '<%=StringUtils.formatDateToString( date52 )%>' );" onMouseOver="window.status='Click to View BackLog Details';return true" onMouseOut="window.status='';return true"><%=inventory.getWeek5()%></A>
			<%		
					}
					else
					{
			%>
					<%=inventory.getWeek5()%>
			<%
					}	
			%>
			</font></td>
			<td width="6%" align="center"><font class="NArialL">
			<% 
					if( inventory.getWeek6() != 0 )
					{
			%>

			<A href="javascript:showBackLog( '<%=StringUtils.formatDateToString( date61 )%>', '<%=StringUtils.formatDateToString( date62 )%>' );" onMouseOver="window.status='Click to View BackLog Details';return true" onMouseOut="window.status='';return true"><%=inventory.getWeek6()%></A>
			<%		
					}
					else
					{
			%>
					<%=inventory.getWeek6()%>
			<%
					}	
			%>
			</font></td>
			<td width="6%" align="center"><font class="NArialL">
			<% 
					if( inventory.getWeek7() != 0 )
					{
			%>

			<A href="javascript:showBackLog( '<%=StringUtils.formatDateToString( date71 )%>', '<%=StringUtils.formatDateToString( date72 )%>' );" onMouseOver="window.status='Click to View BackLog Details';return true" onMouseOut="window.status='';return true"><%=inventory.getWeek7()%></A>
			<%		
					}
					else
					{
			%>
					<%=inventory.getWeek7()%>
			<%
					}	
			%>
			</font></td>
			<td width="6%" align="center"><font class="NArialL">
			<% 
					if( inventory.getWeek8() != 0 )
					{
			%>
			<A href="javascript:showBackLog( '<%=StringUtils.formatDateToString( date81 )%>', '<%=StringUtils.formatDateToString( date82 )%>' );" onMouseOver="window.status='Click to View BackLog Details';return true" onMouseOut="window.status='';return true"><%=inventory.getWeek8()%></A>
			<%		
					}
					else
					{
			%>
					<%=inventory.getWeek8()%>
			<%
					}	
			%>
			</font></td>
			<td width="6%" align="center"><font class="NArialL">
			<% 
					if( inventory.getWeek9() != 0 )
					{
			%>

			<A href="javascript:showBackLog( '<%=StringUtils.formatDateToString( date91 )%>', '<%=StringUtils.formatDateToString( date92 )%>' );" onMouseOver="window.status='Click to View BackLog Details';return true" onMouseOut="window.status='';return true"><%=inventory.getWeek9()%></A>
			<%		
					}
					else
					{
			%>
					<%=inventory.getWeek9()%>
			<%
					}	
			%>
			</font></td>
			<td width="6%" align="center"><font class="NArialL">
			<% 
					if( inventory.getWeek10() != 0 )
					{
			%>
			<A href="javascript:showBackLog( '<%=StringUtils.formatDateToString( date101 )%>', '<%=StringUtils.formatDateToString( date102 )%>' );" onMouseOver="window.status='Click to View BackLog Details';return true" onMouseOut="window.status='';return true"><%=inventory.getWeek10()%></A>
			<%		
					}
					else
					{
			%>
					<%=inventory.getWeek10()%>
			<%
					}	
			%>
			</font></td>
			<td width="6%" align="center"><font class="NArialL">
			<% 
					if( inventory.getWeek11() != 0 )
					{
			%>
			<A href="javascript:showBackLog( '<%=StringUtils.formatDateToString( date111 )%>', '<%=StringUtils.formatDateToString( date112 )%>' );" onMouseOver="window.status='Click to View BackLog Details';return true" onMouseOut="window.status='';return true"><%=inventory.getWeek11()%></A>
			<%		
					}
					else
					{
			%>
					<%=inventory.getWeek11()%>
			<%
					}	
			%>
			</font></td>
			<td width="6%" align="center"><font class="NArialL">
			<% 
					if( inventory.getWeek12() != 0 )
					{
			%>
			<A href="javascript:showBackLog( '<%=StringUtils.formatDateToString( date121 )%>', '<%=StringUtils.formatDateToString( date122 )%>' );" onMouseOver="window.status='Click to View BackLog Details';return true" onMouseOut="window.status='';return true"><%=inventory.getWeek12()%></A>
			<%		
					}
					else
					{
			%>
					<%=inventory.getWeek12()%>
			<%
					}	
			%>
			</font></td>
			<td width="6%" align="center"><font class="NArialL">
			<% 
					if( inventory.getWeek13() != 0 )
					{
			%>
			<A href="javascript:showBackLog( '<%=StringUtils.formatDateToString( date131 )%>', '<%=StringUtils.formatDateToString( date132 )%>' );" onMouseOver="window.status='Click to View BackLog Details';return true" onMouseOut="window.status='';return true"><%=inventory.getWeek13()%></A>
			<%		
					}
					else
					{
			%>
					<%=inventory.getWeek13()%>
			<%
					}	
			%>
			</font></td>
			<%
				}
				else
				{
			%>
			
			<td width="6%" align="center"><font class="NArialL"><%=inventory.getWeek1()%></font></td>
			<td width="6%" align="center"><font class="NArialL"><%=inventory.getWeek2()%></font></td>
			<td width="6%" align="center"><font class="NArialL"><%=inventory.getWeek3()%></font></td>
			<td width="6%" align="center"><font class="NArialL"><%=inventory.getWeek4()%></font></td>
			<td width="6%" align="center"><font class="NArialL"><%=inventory.getWeek5()%></font></td>
			<td width="6%" align="center"><font class="NArialL"><%=inventory.getWeek6()%></font></td>
			<td width="6%" align="center"><font class="NArialL"><%=inventory.getWeek7()%></font></td>
			<td width="6%" align="center"><font class="NArialL"><%=inventory.getWeek8()%></font></td>
			<td width="6%" align="center"><font class="NArialL"><%=inventory.getWeek9()%></font></td>
			<td width="6%" align="center"><font class="NArialL"><%=inventory.getWeek10()%></font></td>
			<td width="6%" align="center"><font class="NArialL"><%=inventory.getWeek11()%></font></td>
			<td width="6%" align="center"><font class="NArialL"><%=inventory.getWeek12()%></font></td>
			<td width="6%" align="center"><font class="NArialL"><%=inventory.getWeek13()%></font></td>

			<%
				}	
			%>
		</tr>
		<%
				}
			}
		%>
	</table>

	<table border="0" width="100%" bordercolor="#FFFFFF">
		<tr><td><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=40></td></tr>
	</table>
	<table border="0" width="100%" bordercolor="#FFFFFF">    
		<tr>
			<td width="15%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Current Inventory</font></td>
			<logic:iterate id="Inventory" name="inventroryDetails">
			<td width="6%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">
				<bean:write name="Inventory" property="processType"/></font></font>
			</td>
			</logic:iterate>
		</tr>
		<tr>
			<td width="15%" align="center" bgcolor="#DEE1E2"><font class="NArialL">Good Units</font></td>
			<logic:iterate id="Inventory" name="inventroryDetails">
			<td width="6%" align="center" bgcolor="#DEE1E2"><font class="NArialL">
				<bean:write name="Inventory" property="goodUnits" /></font>
			</td>
			</logic:iterate>
		</tr>
		<tr>
			<td width="15%" align="center" bgcolor="#FFFFEE"><font class="NArialL">Hold Units</font></td>
			<logic:iterate id="Inventory" name="inventroryDetails">
			<td width="6%" align="center" bgcolor="#FFFFEE"><font class="NArialL">
				<bean:write name="Inventory" property="holdUnits" /></font>
			</td>
			</logic:iterate>
	</tr>

  </table>


	<table border="0" width="100%" bordercolor="#FFFFFF">
		<tr><td><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=40></td></tr>
	</table>

	<table border="0" width="80%" align='left'>
		<tr><td colspan='12'><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=25></td></tr>
        <tr><td>&nbsp;</td><td colspan='11' align='left'><chiptrack:info styleClass="NAriaL"/></td></tr>
        <tr><td>&nbsp;</td><td colspan='11' align='left'><chiptrack:errors styleClass="NAriaL"/></td></tr>
        <tr><td colspan='12'><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=2></td></tr>
		<tr><td colspan='12' align="left" class='NArialL'><FONT id="errors" color='FF0000'></FONT><br></TD></tr>
        <tr><td>&nbsp;</td><td colspan='11' align='left'><font class="NArialL">Line Item Details:</font></td></tr>
        <tr>
            <td width="7%" align="center"><font class="NArialL">&nbsp;</td>
            <td width="5%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Sales Order #</font></td>
            <td width="5%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Line Item</font></td>
            <td width="15%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF"><bean:message key = "label.mfgPartNumber" /></font></td>
            <td width="12%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Quantity</font></td>
            <td width="12%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Unit Price</font></td>
            <td width="12%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Req. Dock Date</font></td>
            <td width="12%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Sugg Ship Date</font></td>
            <td width="10%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Schedule Date</font></td>
            <td colspan='3' width="10%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Actions</font></td>
        </tr>
        <tr>
            <td width="7%" align="center"><font class="NArialL">&nbsp;</td>
            <td width="5%"  bgcolor="#DEE1E2" align=center nowrap><font class="NArialL"><%=lineItem.getSalesOrderNo()%></font></td>
            <td width="5%"  bgcolor="#DEE1E2" align=center nowrap><font class="NArialL"><%=lineItem.getLineItemNo()%></font></td>
            <td width="15%" bgcolor="#DEE1E2" align=center nowrap><font class="NArialL"><%=lineItem.getManufacturingPartNo()%></font></td>
            <td width="12%" bgcolor="#DEE1E2" align=right  nowrap><font class="NArialL">&nbsp;&nbsp;&nbsp;<%=lineItem.getQuantity()%></font></td>

            <td width="12%" bgcolor="#DEE1E2" align=right  nowrap><font class="NArialL"><%=lineItem.getUnitPrice()%></font></td>
            <td width="12%" bgcolor="#DEE1E2" align=right  nowrap><font class="NArialL"><%=lineItem.getRequestDate()%></font></td>
            
            <td width="12%" bgcolor="#DEE1E2" align=right  nowrap><font class="NArialL">
            <%
                String suggDate = lineItem.getSuggScheduleDate();
                if ( ( suggDate == null ) || ( suggDate.trim().length() == 0 ) ) 
				{
            %>
                <a href="javascript:submitForm('reschedule')" onmouseover="window.status='Click to Schedule ';return true" onmouseout="window.status='';return true">Schedule</a>&nbsp;&nbsp;
            <%
				} 
				else 
				{
			%>
				<%=suggDate%><input type='hidden' name='systemSuggDate' value='<%=suggDate%>'>
            <%
				}
			%>
            </font></td>
            <td width="10%" bgcolor="#DEE1E2" align=center nowrap><font class="NArialL">&nbsp;&nbsp;
            <input type=text name='scheduleDate' size='11' maxlength='10' align='left' value='<%=lineItem.getScheduleDate()%>' class='txfield'>
            <a href="javascript:openScheduleCalendar(document.lineItemForm.scheduleDate,'<%=lineItem.getRequestDate()%>')"><img onMouseOver="window.status='Click here to select date';return true" onmouseout="window.status='';return true" border="0" align='center' src="<%=chipTracContext%>/jsp/includes/images/date_selector.gif" height=20 width=20></a>
				<chiptrack:restrictedLink functionality='<%=Functionality.ORDER_SCHEDULING%>' action='<%=User.USER_ACTION_MODIFY%>'styleClass="leftsection" href="javascript:submitForm('saveScheduleDate');" onmouseover="window.status='Click to save schedule date';return true" onmouseout="window.status='';return true">Save Schedule Date</chiptrack:restrictedLink>
            <td width="3%"  bgcolor="#DEE1E2" align=center nowrap><font class="NArialL">&nbsp;
				<chiptrack:restrictedLink functionality='<%=Functionality.ORDER_SCHEDULING%>' action='<%=User.USER_ACTION_MODIFY%>'styleClass="leftsection" href="javascript:submitForm('reschedule');" onmouseover="window.status='Click to reschedule';return true" onmouseout="window.status='';return true">Re-Schedule</chiptrack:restrictedLink>
            <td width="3%"  bgcolor="#DEE1E2" align=center nowrap><font class="NArialL">&nbsp;
            <chiptrack:restrictedLink functionality='<%=Functionality.ORDER_SCHEDULING%>' action='<%=User.USER_ACTION_MODIFY%>'styleClass="leftsection" href="javascript:submitForm('releaseLots');" onmouseover="window.status='Click to Release Schedule';return true" onmouseout="window.status='';return true">Release Schedule</chiptrack:restrictedLink>
            &nbsp;</font></td>

        </tr>
        <% if( !users.isActionAllowed ( Functionality.ORDER_SCHEDULING,
        User.USER_ACTION_MODIFY ) )
        { %>
            <tr><td colspan=7 align='left'>
            <font class='NArialS'>
            <font color='blue'><b><%=Constants.NO_MODIFY_RIGHTS %></b>
            </font></td></tr>
        <% } %>

        <tr><td colspan='12'><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=25></td></tr>
        <tr><td colspan='12' align='center'><font class='NArialL'><a href="javascript:closeWindow();" onmouseover="window.status='Click to Close this Window';return true" onmouseout="window.status='';return true">Close This Window</a></font></td></tr>
        <tr><td colspan='12'><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=25></td></tr>
        <% } else { %>
    <table cellpadding='0' cellspacing='0' bgcolor='FDF5E6' border="0" width="100%"  height="100%" align=center>
        <tr>
            <td>
                <table align="center" border="0" width="40%" bgcolor="#FDF5E6">
                    <tr><td>&nbsp;</td></tr>
                    <tr><td align="center" ><font class="NArialL" ><font color="red">Session has been time out , Please close this window and login again.</font></font></td></tr>
                    <tr><td>&nbsp;</td></tr>
                    <tr><td align="center" ><a href="javascript:window.close();"><font class='NArialL'>[Close this window]</font></a></td></tr>
                </table>
            </td>
       </tr>
       <tr><td>&nbsp;</td></tr>
    </table>
<% } %>
	</table>
</form>
</HEAD>
</BODY>
</HTML>